package org.bigk.invoices.model;

import java.math.BigDecimal;

import org.apache.commons.lang.builder.ToStringBuilder;

public class InvoicePositionSummary {

	private BigDecimal valueNetto;
	private Double percentTax;
	private BigDecimal sum;
	private BigDecimal total;

	public InvoicePositionSummary() {
		valueNetto = BigDecimal.ZERO;
		sum = BigDecimal.ZERO;
		total = BigDecimal.ZERO;
	}

	public InvoicePositionSummary(Double percentTax) {
		valueNetto = BigDecimal.ZERO;
		sum = BigDecimal.ZERO;
		total = BigDecimal.ZERO;
		this.percentTax = percentTax;
	}

	public String toString() {
		return ToStringBuilder.reflectionToString(this);
	}

	public Double getPercentTax() {
		return percentTax;
	}

	public void setPercentTax(Double percentTax) {
		this.percentTax = percentTax;
	}

	public BigDecimal getSum() {
		return sum;
	}

	public void setSum(BigDecimal sum) {
		this.sum = sum;
	}

	public BigDecimal getTotal() {
		return total;
	}

	public void setTotal(BigDecimal total) {
		this.total = total;
	}

	public BigDecimal getValueNetto() {
		return valueNetto;
	}

	public void setValueNetto(BigDecimal valueNetto) {
		this.valueNetto = valueNetto;
	}

	public Integer getInterestRate() {
		return Integer.valueOf((new BigDecimal(100)).multiply(
				BigDecimal.valueOf(percentTax.doubleValue())).intValue());
	}

	public BigDecimal addValueNetto(BigDecimal augend) {
		valueNetto = valueNetto.add(augend);
		return valueNetto;
	}

	public BigDecimal addSum(BigDecimal augend) {
		sum = sum.add(augend);
		return sum;
	}

	public BigDecimal addTotal(BigDecimal augend) {
		total = total.add(augend);
		return total;
	}
}
